#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 2e5 + 10;
const int mod = 998244353;
int siz[maxn];
int vis[maxn];
int ans[maxn];
vector<int> pos[maxn];
signed main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, q;
    cin >> n >> q;
    int cnt = 0;
    for (int i = 1; i <= q; i++) 
	{
        int x;
        cin >> x;
        pos[x].push_back(i);
        vis[x] ^= 1;
        if (vis[x])
            cnt++;
        else
            cnt--;
        siz[i] = cnt;
        siz[i] += siz[i - 1];
    }
    for (int i = 1; i <= n; i++)
        if (pos[i].size() % 2 == 1)
            pos[i].push_back(q + 1);
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < pos[i].size(); j += 2) {
            ans[i] += siz[pos[i][j + 1] - 1] - siz[pos[i][j] - 1];
        }
    }
    for (int i = 1; i <= n; i++)
        cout << ans[i] << " ";
    // system("pause");
    return 0;
}

